Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add update_database option #50

Merged
merged 2 commits into from
Feb 8, 2022
Merged

add update_database option #50

merged 2 commits into from
Feb 8, 2022

Conversation

tomredhot
Copy link
Contributor

not update database field (eg: if don't exist), but do all others things

not update database field (eg: if don't exist), but do all others things
@tomredhot
Copy link
Contributor Author

tomredhot commented May 12, 2020

Test :

Name of input type file: "image"

Model :

protected static $imageFields = [
        'image'=>[],
        'image300'=>[
            'width' => 300,
            'height' => 300,
            'crop' => true,
            'auto_upload' => true,
            'file_input' => 'image',
            'update_database'=> false
        ],
        'image600'=>[
            'width' => 600,
            'height' => 600,
            'crop' => true,
            'auto_upload' => true,
            'file_input' => 'image',
            'update_database'=> false
        ],
    ];
    protected function imageUploadFilePath($file) {
        return $this->id . '-image.jpg';
    }
    protected function image300UploadFilePath($file) {
        return $this->id . '-image-300.jpg';
    }
    protected function image600UploadFilePath($file) {
        return $this->id . '-image-600.jpg';
    }

Model field in database : "id", "image" [...] (but not "image300" & "image600")

Files saved after submit :
image
(crop okay for image300 & image600)

Files correctly updated after second submit

ImageTag

{!!  $site->imageTag('image')  !!}  // ok
{!! $site->imageTag('image300')  !!}  // problem
{!! $site->imageTag('image600')  !!} // probem

@tomredhot
Copy link
Contributor Author

tomredhot commented May 12, 2020

ImageTag

{!!  $site->imageTag('image')  !!}  // ok
{!! $site->imageTag('image300')  !!}  // ok
{!! $site->imageTag('image600')  !!} // ok

ImageUrl

{!!  $site->imageUrl('image')  !!} // ok
{!! $site->imageUrl('image300')  !!} // ok
{!! $site->imageUrl('image600')  !!} // ok

Hooks
eg

 'image300'=>[
            'width' => 300,
            'height' => 300,
            'crop' => true,
            'auto_upload' => true,
            'file_input' => 'image',
            'update_database'=> false,
            'before_save' => BlurFilter::class,
        ],

Ok

Change naming rules
Delete only "image" (not "image300" & "image600")
No solution, old name unknow

@saqueib saqueib merged commit 171b166 into qcod:master Feb 8, 2022
@saqueib
Copy link
Member

saqueib commented Feb 8, 2022

Thanks @tomredhot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants